/*
 * File:   LZ77Test.cpp
 * Author: Daniela
 *
 * Created on Apr 9, 2013, 3:42:34 PM
 */

#include "LZ77Test.h"


CPPUNIT_TEST_SUITE_REGISTRATION(LZ77Test);

LZ77Test::LZ77Test()
{
}

LZ77Test::~LZ77Test()
{
}

void LZ77Test::setUp()
{
}

void LZ77Test::tearDown()
{
}

CompressionErrorCode compressLZ77(const CompressionData& input, CompressionData* output);
CompressionErrorCode decompressLZ77(const CompressionData& input, CompressionData* output);

void LZ77Test::testLZ77SpecialCase()
{
    CompressionData input;
    CompressionData output;
    CompressionData expected;
    input.content = "hahahaha";
    input.contentSize = strlen(input.content);
    compressLZ77(input, &output);
    decompressLZ77(output, &expected);

    CPPUNIT_ASSERT(strcmp(expected.content, input.content) == 0);
}

void LZ77Test::testLZ77()
{
    CompressionData input;
    CompressionData output;
    CompressionData expected;
    input.content = "abracadabra";
    input.contentSize = strlen(input.content);
    compressLZ77(input, &output);
    decompressLZ77(output, &expected);

    CPPUNIT_ASSERT(strcmp(expected.content, input.content) == 0);
}

